package io.imp.modules.tasks.unionqrc.dao;

import io.imp.modules.tasks.unionqrc.entity.ItcsStationInfo;
import io.imp.orm.dao.JpaDao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ItcsStationInfoDao extends JpaDao<ItcsStationInfo,String> {
    /**
     * 根据车站id获取车站名
     * @param station_id
     * @return
     */
    @Query(value = "SELECT\n" +
            "name\n" +
            "FROM\n" +
            "itcs_station_info\n" +
            "WHERE\n" +
            "station_id = :station_id",nativeQuery = true)
    public String getSnameBySid(@Param("station_id") String station_id);

    /**
     * 获取所有车站id和车站名
     * @return
     */
    @Query(value = "SELECT new ItcsStationInfo (stationid,name) from ItcsStationInfo")
    List<ItcsStationInfo> getItcsStationInfoBySid();
}
